<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="cliente" type="br.uff.javabasico.modelos.Cliente" scope="session" />
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        
        <script>
            function verifica(form){
                alert(form);
                var botao = document.getElementById();
                return false;
            }
        </script>
        
    </head>
    <body>
        
        <h1>Olá <jsp:getProperty name="cliente" property="nome"/> ( ${cliente.numero} )</h1>
        <br/>
        <h3 style="color:red" >${sessionScope["ERRO"]}</h3>
        <h3 style="color:green" >${sessionScope["SUCESSO"]}</h3>
        <hr/>
        <form action="/Trabalho2/ServletSessao" name="formulario" method="POST">
            <div>
                <fieldset style="width:41%;border:3px">
                    <legend>Número do Produto:</legend>
                    &nbsp; <input type="text" id="txtNumProduto" name="NumProduto">                     
                    <input type="submit" value="Adicionar Produto" name="Adicionar">
                    <br/><br/>
                    &nbsp;<input type="submit" value="Remover Produto" name="Remover" style="width:155px">
                    <input type="submit" value="Fechar Compra" name="Fechar" style="width:155px">
                </fieldset>
            </div>
        </form>
        <h2>Lista de Itens já salvos</h2>
        <br/>
        <table border="4" style="position:center">
            <tr>
                <td><b>Número do(s) Item(s):</b></td>      
            </tr>
            <c:forEach items="${cliente.listaDeItens}" var="item">
                <tr>
                    <td>
                        ${item}
                    </td>
                </tr>
            </c:forEach>
        </table>
        
        
    </body>
</html>
